package faa.expertise.helloadf.view;

import java.beans.Beans;

import oracle.adf.controller.v2.lifecycle.ADFLifecycle;
import oracle.adf.controller.v2.lifecycle.Lifecycle;
import oracle.adf.controller.v2.lifecycle.PagePhaseEvent;
import oracle.adf.controller.v2.lifecycle.PagePhaseListener;

public abstract class InteractivePagePhaseListener implements PagePhaseListener {
    
    static {
      ADFLifecycle.getInstance().addPagePhaseListener(new ProgramPagePhaseListener(), "PPL_ID", null, null);
    }
    
    public void afterPhase(PagePhaseEvent pagePhaseEvent) {
        System.out.println("[" + getType() + "] after " +
                           Lifecycle.getPhaseName(pagePhaseEvent.getPhaseId()));
    }

    public void beforePhase(PagePhaseEvent pagePhaseEvent) {
        System.out.println("[" + getType() + "] before " +
                           Lifecycle.getPhaseName(pagePhaseEvent.getPhaseId()));
    }

    protected abstract String getType();
}
